package com.sinping.qh.query.lab;

import com.sinping.qh.query.base.Operator;
import com.sinping.qh.query.base.QueryParams;
import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * 楼宇查询
 *
 * @author Tiansx
 * @create 2018-05-30 20:33
 **/
@Data
public class BuildingQuery implements QueryParams,Serializable {
    private static final long serialVersionUID = 2651690264100037288L;
    static Map<String, String> aliasMap = new HashMap<>();
    static Map<String, Operator> operatorMap = new HashMap<>();

    private String buildingName;
    private String status;
    static {
        aliasMap.put("buildingName", "building_name");
        aliasMap.put("status","status");

        operatorMap.put("buildingName", Operator.regex);
        operatorMap.put("status", Operator.eq);

    }

    @Override
    public String getAlias(String fieldName) {
        return aliasMap.getOrDefault(fieldName, fieldName);
    }

    @Override
    public Operator getOperators(String fieldName) {
        return operatorMap.getOrDefault(fieldName, Operator.eq);
    }
}
